home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Cream of the Crop 1
/
Cream of the Crop 1.iso
/
PROGRAM
/
CUJ9104.ARJ
/
9N04088A
< prev
next >
Wrap
Text File
|
1991-02-15
|
936b
|
52 lines
/* all_true.c */
/* ---------- */
/*
No matter what code the calling program returns, this
program will always return 0 (success).
Usage: all_true program args
Example: all_true sleep 5
*/
#include <stdio.h>
#include <signal.h>
#define RET_VALUE 0
main(argc,argv)
int argc;
char **argv;
{
process(argc,argv);
exit(RET_VALUE);
}
process(argc,argv)
int argc;
char **argv;
{
int pid;
if ((pid = fork()) == -1)
{
perror("all_true");
exit(1);
}
if (pid > 0 )
{
signal(SIGINT,SIG_IGN); /* Ignore interrupt key */
while (wait( (int *) 0 ) == pid);
return;
}
signal(SIGINT,SIG_DFL); /* Default interrupt key */
argv++; /* Point to program argument */
execvp(*argv, argv);
perror("all_true");
}